<template>
  <div>测试首页</div>
  <div>
    <el-button type="primary">ui按钮测试</el-button>
  </div>
  <hr />
  <input type="file" @change="selectFile" accept="image/*" />
  <hr />
  <el-button type="success" @click="openImege">浏览文件...</el-button>
  <span v-if="file">
    {{ file.name }}
  </span>
</template>
<script setup>
import { tools } from '../../js/tools'
import { ref } from 'vue'

const file = ref(null)

const selectFile = event => {
  console.log('selectFile:', event, event.target)
  console.log('选中的文件:', event.target.files)
}
const openImege = () => {
  file.value = null
  tools.openImage(data => {
    file.value = data
  })
}
</script>
<style scoped></style>
